#include "Cell.h"
#include <iostream>
//CRAZY!!
//Cell
//
//Constructor that creates cells
//
//Pre:	None
//Post: Sets the flooded bool to false,
//		sets the nextTo bool to false
//
Cell::Cell()    //When a Cell is created, perform these default actions.
{
            cellColor;  //The color of the cell. The colors in order are R,G,B,Y,P,O

        flooded = false;        //To determine whether the cell has been flooded
        nextTo = false;         //To determine whether the cell is next to the flooded region
}

//SetColor
//
//Takes a Color and sets the cell to that Color
//
//Pre:	Requires a color
//
//Post: Sets the color of the cell to the Color input
//
void Cell::SetColor(int newColor)       //This function will set the color according to the number passed in.
{
        //      0 = RED
        //      1 = GREEN
        //      2 = BLUE
        //      3 = YELLOW
        //      4 = PURPLE
        //      5 = ORANGE

        if(newColor == 0) { cellColor = Red; }
        if(newColor == 1) { cellColor = Green; }
        if(newColor == 2) { cellColor = Blue; }
        if(newColor == 3) { cellColor = Yellow; }
        if(newColor == 4) { cellColor = Purple; }
        if(newColor == 5) { cellColor = Orange; }
}

//GetColor
//
//Function to return a letter representing the Color of the cell
//
//Pre:	None
//
//Post: Returns a char
//
char Cell::GetColor()   //This function will return a char value of the Color instead of the int value.
{
        if(cellColor == Red) { return 'R'; }
        else if(cellColor == Green) { return 'G'; }
        else if(cellColor == Blue) { return 'B'; }
        else if(cellColor == Yellow) { return 'Y'; }
        else if(cellColor == Purple) { return 'P'; }
        else if(cellColor == Orange) { return 'O'; }
        else {return '!';}      //This is incase a cell was not assigned a proper color.
}

//getActualColor
//
//Function to return the Color that the cell is currently set to
//
//Pre:	None
//
//Post: Returns a Color
//
Color Cell::getActualColor()
{
	return cellColor;
}

//SetNextTo
//
//Takes a bool as input and sets the nextTo bool to the input
//
//Pre:	Requires a bool
//
//Post: Sets nextTo to the bool input
//
void Cell::setNextTo(bool bb)
{
	nextTo = bb;
}

//getNextTo
//
//Returns the value of the nextTo bool
//
//Pre:	None
//
//Post: Returns a bool
//
bool Cell::getNextTo()
{
	return nextTo;
}

//setCounted
//
//Takes a bool as input and sets the counted bool to the input. This is for when the countColorNextToFlooded function in
//the GameBoard class is determining which color has the highest priority, and will keep the cell from being counted twice.
//
//Pre:	Requires a bool
//
//Post: Sets counted to the bool input
//
void Cell::setCounted(bool bb)
{
	counted = bb;
}

//getCounted
//
//Returns the value of the bool, counted
//
//Pre:	None
//
//Post: Returns a bool
//
bool Cell::getCounted()
{
	return counted;
}

//setFlooded
//
//Sets the value of the bool, flooded.
//
//Pre:	Requires a bool
//
//Post: Sets flooded to the input value
//
void Cell::setFlooded(bool bb)
{
	flooded = bb;
}

//getFlooded
//
//Returns the value of the bool, flooded.
//
//Pre:	None
//
//Post: Returns a bool
//
bool Cell::getFlooded()
{
	return flooded;
}
